package com.future.account;

import com.future.account.config.MyRibbonClientConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.client.RestTemplate;

/**
 * 账号服务启动类
 *
 * @author shiyong
 * 2021/3/29 8:11
 */
@EnableEurekaClient
@RibbonClients(defaultConfiguration = MyRibbonClientConfiguration.class)
@SpringBootApplication()
@ComponentScan(basePackages = {"com.future.account"}, excludeFilters =
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = MyRibbonClientConfiguration.class))// 启动时不注册MyRibbonClientConfiguration
public class AccountServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(AccountServiceApplication.class, args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
